package com.teewe.model.data
{
	public class Question extends GameElement
	{
		public var text:String;
		public var timeToAnswer:int;
		public var number:int;
		public var answers:List; /* Answer */
		
		public function Question(xml:XML)
		{
			super (xml);
		}
		
		public function getCorrectAnswerIndex():int
		{
			for (var i:int = 0; i < answers.length; i++)
			{
				if (answers[i].correct == true)
					return i;
			}
			
			throw new Error ("no correct answer found in Question:" + id);
		}
		
		public function getCorrectAnswer ():Answer
		{
			return answers[getCorrectAnswerIndex()];
		}
	}
}